package com.vf.cloud.paas.app.master.api.ue.controller;


import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.jfinal.kit.StrKit;
import com.vf.cloud.paas.app.master.common.domain.SceneAction;
import com.vf.cloud.paas.common.cirrus.Cirrus;
import com.vf.cloud.paas.common.util.R;
import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
@RestController
@RequestMapping("/api/v1/ue")
public class UEController {
	
	@RequestMapping(value = "/order", method = RequestMethod.POST)
	public R<String> order(@RequestBody SceneAction action) {

		if(StrKit.isBlank(action.getToken())) {
			return R.failed("请填写调用的UE客户端Token.");
		}
		
		if(StrKit.isBlank(action.getAppId())) {
			return R.failed("请填写应用ID.");
		}
		
		if(!Cirrus.UE_Client.containsKey(action.getToken())) {
			return R.failed("掉线，稍后再试.");
		}
		Cirrus.UE_Client.get(action.getToken());
		return R.ok();
	}

}
